<?php

class Xzsdsplus_Costpriceplus_Model_Resource_Mysql4_Action extends Mage_Catalog_Model_Resource_Eav_Mysql4_Abstract {

	public function updateAttributes($bannerIds, $attrData, $storeId) {
		
		foreach($attrData as $key => $val) {
			if (is_array($bannerIds)) {
				try {
					$ids = implode(',', $bannerIds);
					$db = Mage::getSingleton('core/resource')->getConnection('core_write');
					$db->query(" UPDATE costpriceplus SET {$key} = {$val} WHERE banner_id IN ({$ids})");
					/*
					Mage::getSingleton('adminhtml/session')->addSuccess(
						$this->__('Total of %d record(s) have been update.', count($bannerIds))
					);
					*/
				} catch (Exception $e) {
					Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
				}
				return $this;
			}
		}
	}
}